import java.util.Scanner;

public class test {
    /*//创建方法求两个数的最大值max2，随后再写一个求3个数的最大值的函数max3。
    //要求：在max3这个函数中，调用max2函数，来实现3个数的最大值计算
    public static  int max2(int a,int b){
        return a>b?a:b;
    }
    public static  int max3(int a,int b,int c){
         return max2(max2(a,b),c);
    }


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入第一个数");
        int a = scanner.nextInt();
        System.out.println("输入第二个数");
        int b = scanner.nextInt();
        System.out.println("输入第三个数");
        int c = scanner.nextInt();
        System.out.println(max2(a,b));
        System.out.println(max3(a,b,c));

    }*/
    //求 N 的阶乘
  /*  public  static  int  factorial(int a){
        int ret = 1;
        for (int i = 1; i <=a; i++) {
                ret *= i;
        }
        return  ret;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入想要多少位的阶乘");
        int a = scanner.nextInt();
        System.out.println(factorial(a));
    }*/
//求 N 的阶乘的和
    /*public  static  int  factorialsum(int a){

        int sum = 0;
        for (int i = 1; i <= a; i++) {
            int ret = 1;
            for (int j = 1; j <= i; j++) {
                ret *= j;
            }
            sum +=ret;
        }

        return  sum;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入想要多少位的阶乘的和");
        int a = scanner.nextInt();
        System.out.println(factorialsum(a));
    }*/
    //求斐波那契数列的第n项。(迭代实现)
  /*  public static  int  sequence(int a){
        if (a == 1 || a == 2) {
            return 1;
        }
        int s1 = 1;
        int s2 = 1;
        int s3 = 1;
        for (int i = 3; i <= a; i++) {
            s3 = s1 + s2 ;
            s1 = s2;
            s2 = s3;
        }
        return s3;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        System.out.println(sequence(a));
    }
*/
    // 在同一个类中,分别定义求两个整数的方法 和 三个小数之和的方法。 并执行代码，求出结果
  /*  public  static  int add(int a,int b){
        return a+b;
    }
    public static  int add(int a,int b, int c){
        return a+b+c;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数");
        int a = scanner.nextInt();
        System.out.println("请输入第二个数");
        int b = scanner.nextInt();
        System.out.println("请输入第三个数");
        int c = scanner.nextInt();

        System.out.println(add(a,b));
        System.out.println(add(a,b,c));
    }*/
    //在同一个类中定义多个方法：要求不仅可以求2个整数的最大值，还可以求3个小数的最大值？
    public static  int max (int x,int y){
        return x>y?x:y;
    }
    public  static  double max(double x, double y, double z){
        double max = x>y?x:y;
        return max>z?max:z;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个整数");
        int a =scanner.nextInt();
        System.out.println("请输入第二个整数");
        int b =scanner.nextInt();

        System.out.println("较大值为"+max(a,b));


        System.out.println("请输入第一个小数");
        double x =scanner.nextDouble();
        System.out.println("请输入第二个小数");
        double y =scanner.nextDouble();
        System.out.println("请输入第三个小数");
        double z =scanner.nextDouble();
        System.out.println("较大值为"+max(x,y,z));

    }
}
